import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';

extension StringToastEx on String {
  void toast({
    VoidCallback? onDismiss,
    duration = const Duration(seconds: 2),
    textPadding = const EdgeInsets.all(12),
    radius = 13,
    textStyle = const TextStyle(fontSize: 18.0),
  }) {
    SmartDialog.showToast(this, displayTime: duration);
    if (onDismiss != null) {
      Future.delayed(duration, () {
        onDismiss();
      });
    } else {
      Future.delayed(duration);
    }
  }
}
